So far whatever you have learned, especially the identifiers, if you don't know what to do with them, your knowledge is pretty much useless. It'd be like owning a 26th century computer (which looks like a sheet of glass) without the manual and you don't see any buttons or any interactive component on or with it. Hmmmm it would very much be a useless computer if you didn't know what to do with it, no matter how powerful it may be. The same things applies to identifiers, if you don't know what to do with them or how to use them, their knowledge is almost useless. mIRC commands are what make variables useful.
You shouldn't take my covering of the commands after identifiers as commands being of lesser significance than identifiers. Knowledge of both the subjects are equally important. Actually you should learn them simultaneously. If you have two monitors, I suggest you open the page on identifiers on one and this page on another, spawn two threads in your brain and read up the two simultaneously.
The most comprehensive documentation on mIRC commands can be found ... in the Help File that comes with mIRC, of course. where else would you expect to find? www.mircscripts.org? Even they will tell you to read up the Help File when it comes to commands. So I hope you are not expecting me to list down the whole commands here, do you? If yes, press Alt+F4 here and then press F1 in mIRC.
Ok, I won't be listing the whole of the mIRC commands here but I will list a few of the commonly used IRC and mIRC commands and also tell you the difference between IRC commands and mIRC commands.
The commands in mIRC can be basically categorized into two types. Ones that get translated to IRC commands layed down by RFC 1459 (IRC protocol specific) and those which are limited to activity in the IRC client or the local system (client specific). IRC protocol specific commands are those which perform IRC functions like joining and parting channels, changing nick, messaging and noticing, setting modes like +o +b +v +i +m, setting the topic of a channel etc. These commands are sent to the IRC server by mIRC. And client specific commands are those which are not related to IRC directly and are not sent to the server. These commands result in actions confined to the mIRC client and the host computer like changing the color of the text, echoing, starting a timer, opening custom window, aliases, accessing files, creating directories, opening sockets etc.
In actuality, all the commands in mIRC are Khaled's own inventions. mIRC is like a translator with ease of use in priority. You use mIRC's nick command, mIRC takes the parameter and does a NICK command for you on the server. Instead of the nick command in the client it can me named to anything as long as it's finally translated to NICK when issued on the server. The way the protocol specific commands and the client specific commands work can often be confusing and seem like the same thing in some places. To clear your doubt about the way IRC clients work read the article
IRC clients - How they work. You will get a clearer understanding about commands.
Some of the commonly used IRC specific commands are listed below. The front slash is optional if you are executing the commands from a script but they are mandatory if executed from the command line.
/join #channel Joins the channel named #channel.
/part #channel Parts #channel.
/msg #channel/nick :This is the message. Sends message to the channel or nick.
/notice #channel/nick :This is the notice message. Sends a notice to the channel or the nick.
/whois nick Retrieves info about the nick.
/topic #channel Hey look! This is a new topic. Sets a new topic for #channel.
/mode #channel +o PunkMonkey Gives OP to PunkMoney on #channel.
/kick #channel PunkAss Kicks PunkAss from #channel.
/msg PunkGirl Hi baby! Sends a message to PunkGirl without openin a new window.
/hop #channel Parts and joins #channel again.
/ignore CrazyMonkey Puts CrazyMonkey in the ignore list.
/invite NomadPunk #channel Invites NomadPunk to #channel.
/quit I feel unloved You quit with the quit message "I feel unloved".
/me is a mutant * Punk-Boi is a mutant.
/mode #channel +b BadMonkey Bans BadMonkey on #channel.
Well there are many more IRC specific commands in mIRC. Some of the useful IRC specific commands are: notify, part, partall, ignore, flood, op, aop, me, describe, list, omsg, raw, whois, whowas, server, quit, query and many many more. Refer the Help File to know them all. Want me to list them all here? If yes, press ALT+F4 here and press F1 in mIRC.
Normally commands executed from the command line will not evaluate mIRC variables and identifiers. For instance if you type
/echo -a $me, you will get "$me" instead of your nick. To make the mIRC variables and identifiers evaluated by commands executed from the command line use double front slashes (//). Eg:
//echo -a $me will echo your nick. Here's one example, type the following codes one after another in the command line to see the effect of // in action.
/set %msg Bowling for Soup
/echo -a %msg
//echo -a %msg
/set %msg Punk Rock 101
//echo -a %msg
/unset %msg
Well, so you can see the probable uses of the // prefixed commands from the command line. And note, none of the commands above are IRC related, they were client specific commands. I just wanted to show you the use of // and introduce you to client specific commands and variables.
The use of # within // in the command line of a channel window will evaluate # as the active channel.
//topic # Blah! Blah! New topic on #. will set the topic on #channel as "Blah! Blah! New topic on #channel." Try
//cs info # if you are on DALnet.
Next we'll see some client specific commands in mIRC. Their effects are restricted within the software (mIRC) or the local system (your computer). Logically you can classify these commands to software commands and system commands. Software commands affect the working of mIRC and it's properties and features. System commands gives you access to the shell and they are what makes mIRC scripting such a powerful scripting language. Powerful enough to give yourself the "Blue screen of Death" in Windows 98 if you are experimental enough. We'll see in brief some of the commonly used software and system commands next.
The simplest example of the software command in mIRC is the
echo command. It echoes the parameter(s) you pass to it. Only you can see it, nobody else on IRC. Because that command sends nothing to the server. What you do with these commands will affect only your mIRC environment only and none else would know about it, unless you tell them. There are a lot many software commands and you need to know all of then if you plan to become a good and a useful scripter. It's time that you looked up the Help File for them. They are not listed as software commands, it's my own way of classifying the client specific commands in mIRC. You will find them under the mIRC commands section. Some of the useful software commands are listed below.
alias (an indispensable command), anick, background, clear, close, color, debug, dialog, echo, exit, editbox, emailaddr, filter, flash, font, fullname, help (very useful, rarely used), load, loadbuff, log, set, strip, timestamp, tnick, unload, unset, window and many many more.
Some of the useful system commands are: clipboard, copy, dde, dll, flushini, mkdir, remini, remove, rename, rmdir, run, vcmd, write, writeini, splay etc. It's these commands that let you do so many really cool things with your scripts, apart from kicking and banning people on your channel. Need I repeat again that you need to look up the Help File for the rest of the commands? If yes, press ALT+F4 right now, right here!
Well, some of the commands, you won't find them listed under Basic IRC Commands or mIRC Commands. To search for all the commands, open the Help File in index mode (click on the Index tab). Next, enter / in the field 1, you get all the mIRC commands, all of them yes. As we have already seem some identifiers take in parameters are perform actions on them, they work more like commands. You will need to learn about all such identifiers to be able to write cool and useful scripts.
Here's a useful tip. In some cases mIRC will echo that a command has been executed. For example when you set an alias named
hw from the command line your get * Added '/hw' alias. If you want to execute the command silently you prefix the command with a dot. For example:
/.alias hw echo -a Hello World!. When executing a 'noisy' command from a script you don't need to include the front slash (/), just prefix the command with a dot.
msg,
notice,
timer and
load are examples of 'noisy' commands in mIRC. Rest you can find out by experimenting.
Custom Commands - Aliases created in Remotes
Ok now, I am going to show you something very interesting. I am going to show you how to create your own commands. Give them any name you want to, except those reserved by mIRC and define your own functions. Actually we did it in the chapter on Aliases. Aliases are actually custom commands. But here we'll be creating still cooler aliases.
I suggest you always use Remote to create your Aliases and Popups. The process is not tough, it's more convenient, logical and easier to debug and manage with your Remote scripts. So now create a new Remote file and name it commands.mrc we'll create the custom commands in it. We'll write a channel management script. mIRC comes with two alias based default commands /op and /dop. We'll create /vo, /dvo, /b and /db. When calling these commands from a script you don't need to use the /. Type the following code in commands.mrc and save it.
alias vo mode # +v $1
alias dvo mode # -v $1
alias b mode # +b $1
alias ub mode # -b $1
Now try out the commands on a channel you are an Op. Type
/vo LuckyNick etc. As you might have noticed by now, the command takes one parameter and performs the action on it. "It's not very cool", you might say. Ok now we'll create a popup and use the aliases like internal commands and make it a little cooler. For that we'll be modifying the code a little bit - replace $1 with $1-. It should look like the following now.
alias vo mode # +v $1-
alias dvo mode # -v $1-
alias b mode # +b $1-
alias ub mode # -b $1-
Add the following lines of code in the commands.mrc. We'll create a Popup from Remote. And it will be available specifically from the Channel window only.
menu channel {
Voice: vo $snicks
DeVoice: dvo $snicks
Ban: b $snicks
UnBan: ub $snicks
}
How does it work? The popup calls the Alias and gives it the parameter $snicks. And $snicks returns all the nicks you have selected in the Nick list window. Probably you must have tested the script with only one nick selected, select more and try again the mode command will be performed on all the selected nicks. It wouldn't have been possible if we did not change $1 to $1-. It's the use of $1- that accomodates all the input parameters from one to infinity.
Hmmmm now, mIRC has got a /hop command which makes you part the channel and join it again. We'll create a command which will make you part the channel and join it again after three seconds exactly. What shall we name the command as? /pop. The code follows. Type it in the commands.mrc file.
alias pop {
set %my.chan #
part %my.chan
timerone 1 3 join %my.chan
timertwo 1 4 unset %my.chan
}
Figured how it works? when you call the alias /pop it first sets a
Variable (discussed in the next chapter) called %myChan with the name of the active channel as it's value. Then it parts the active channel. It then starts two timers, named one and two. Timer one executes the join command after three seconds, it joins the old channel again. The name of the channel is retrieved from the %myChan variable. Timer two executes after four seconds and it unsets the variable we set at the beginning.
Another way to do the same would be:
alias pop {
part #
timerone 1 3 join #
}
But if you want mIRC to 'remember' the channel you popped out from, the one using variables will be the one which will be useful and works. Observe the use of the variable set in the previous example, in the following example.
on *:text:last pop?:*: {
if (%myChan) {
msg $nick %myChan is the latest channel I popped out from.
msg $nick Your are the first and last person I am telling my latest popping secret.
unset %myChan
}
}
When someone messages you "last pop?", mIRC checks for the existence of the variable %myChan, if it's there (which means you have used the
pop command and no one has messaged you a "lat pop?" message yet) it message the nick with the latest channel on which you used the
pop command. Then it unsets the variable so that it' doesn't reply to the question more than once. I hope this command helped you in getting some idea about
Variables and their probably uses.
Custom commands are very useful in grouping functionally related mIRC commands in more complex scripts. They help you to break up the processing into smaller logical chunks when it is has to execute many many commands and is full of ifs, elseives and else. If you study my scripts you will notice I always use them. They make debugging a hell lot easier.
Apart from making your life as a scripter easier, custom commands can be used to make tasks which requires a lot of clicking and typing easier. Here are some of the aliases I always have in my mIRC. You will find them useful too. I won't explain what they do, it's homework for you to figure them out. You will especially like
c: if you are using a comp on which the Administrator has hidden the drive C:. Also find out what
hx and
asc do.
alias c clear
alias d run $mircdir
alias - server losangeles.ca.us.undernet.org
alias n notice $1 $2-
alias a: run A:
alias c: run C:
alias np run notepad
alias t run telnet
alias e echo -a $1-
alias hx e $base($1,10,16)
chr echo -a $chr($1)
asc {
if ($1) { echo -a $asc($1) }
else {
var %i 1
while (%i <= 255) {
if (%i == 32) { echo -a - ASCII value of %i : Space | inc %i | continue }
echo -a - ASCII value of %i : $chr(%i)
inc %i
}
}
}
Ok, I will explain what the alias
asc does. First it checks if the user has passed a parameter, if it is true, it echoes the corresponding ASCII value of the character. Else, it creates a local (temporary) variable %n with the value 1. Then it echoes the corresponding ASCII value of %n and increments it's value by 1 and does the same with the new value till the value of %n is equal to 255. Note: mIRC can't print the space character so it gives an error and halts the script when the value of %n is 32, which is the ASCII value of the space character. So instead of letting mIRC try to echo it, we specify the result ourselves for the the ASCII value 32 and just move on to the next number with an
inc statement followed by a
continue statement. Do you see any use of this alias?
In the last few examples you have come across variables in two places. You must have noticed they are capable of some cool things. Are you already eager to know more about them? They are the stuff mIRC uses to 'remember' things. The next chapter deals with them.
Back
|
Table of Contents
|
Variables
Copyright © 2002-2004 SpyderWares.
Feel free to distribute this tutorial in part or whole, just make sure the credits stay intact.
http://spyderwares.com